package com.dt.platform.generator.module.oa;

import com.dt.platform.constants.db.OaTables;
import com.dt.platform.domain.oa.FinCompanySubject;
import com.dt.platform.domain.oa.meta.FinReimburseItemMeta;
import com.dt.platform.generator.config.Config;
import com.dt.platform.oa.page.FinCompanySubjectPageController;
import com.dt.platform.proxy.oa.FinCompanySubjectServiceProxy;
import com.github.foxnic.generator.config.WriteMode;
import org.github.foxnic.web.domain.system.DictItem;
import org.github.foxnic.web.domain.system.meta.DictItemMeta;
import org.github.foxnic.web.proxy.system.DictItemServiceProxy;

public class FinCompanySubjectGtr extends BaseCodeGenerator {


    public FinCompanySubjectGtr() {
        super(OaTables.OA_FIN_COMPANY_SUBJECT.$TABLE,"876475835756838912");
    }

    public void generateCode() throws Exception {
        System.out.println(this.getClass().getName());


        cfg.view().field(OaTables.OA_FIN_COMPANY_SUBJECT.ID).basic().hidden(true);

        cfg.view().field(OaTables.OA_FIN_COMPANY_SUBJECT.NAME).search();
        cfg.view().field(OaTables.OA_FIN_COMPANY_SUBJECT.BANK).search();

        cfg.view().search().inputLayout(
                new Object[]{
                        OaTables.OA_FIN_COMPANY_SUBJECT.NAME,
                        OaTables.OA_FIN_COMPANY_SUBJECT.BANK,
                }
        );


        cfg.view().search().labelWidth(1,Config.searchLabelWidth);
        cfg.view().search().labelWidth(2,Config.searchLabelWidth);
        cfg.view().search().labelWidth(3,Config.searchLabelWidth);
        cfg.view().search().labelWidth(4,Config.searchLabelWidth);
        cfg.view().search().inputWidth(Config.searchInputWidth);


        cfg.view().field(OaTables.OA_FIN_COMPANY_SUBJECT.NAME).form().validate().required();
        cfg.view().field(OaTables.OA_FIN_COMPANY_SUBJECT.NOTES).form().textArea().height(150);


        cfg.view().field(OaTables.OA_FIN_COMPANY_SUBJECT.CREATE_BY).table().disable(true);
        cfg.view().field(OaTables.OA_FIN_COMPANY_SUBJECT.UPDATE_BY).table().disable(true);
        cfg.view().field(OaTables.OA_FIN_COMPANY_SUBJECT.UPDATE_TIME).table().disable(true);

        cfg.view().field(OaTables.OA_FIN_COMPANY_SUBJECT.BANK_ACCOUNT).table().disable(true);
        cfg.view().field(OaTables.OA_FIN_COMPANY_SUBJECT.ADDRESS).table().disable(true);
        cfg.view().field(OaTables.OA_FIN_COMPANY_SUBJECT.CODE).table().disable(true);
        cfg.view().formWindow().bottomSpace(50);
        cfg.view().formWindow().width(Config.baseFormWidth);


        cfg.view().form().addGroup(null,
                new Object[] {
                        OaTables.OA_FIN_COMPANY_SUBJECT.NAME,
                        OaTables.OA_FIN_COMPANY_SUBJECT.BANK,
                },
                new Object[] {
                        OaTables.OA_FIN_COMPANY_SUBJECT.BANK_ACCOUNT,
                        OaTables.OA_FIN_COMPANY_SUBJECT.ADDRESS,
                }
        );


        cfg.view().form().addGroup(null,
                new Object[] {
                        OaTables.OA_FIN_COMPANY_SUBJECT.NOTES,
                }
        );

        //文件生成覆盖模式
        cfg.overrides()
                .setServiceIntfAnfImpl(WriteMode.COVER_EXISTS_FILE) //服务与接口
                .setControllerAndAgent(WriteMode.COVER_EXISTS_FILE) //Rest
                .setPageController(WriteMode.COVER_EXISTS_FILE) //页面控制器
                .setFormPage(WriteMode.COVER_EXISTS_FILE) //表单HTML页
                .setListPage(WriteMode.COVER_EXISTS_FILE)
                .setExtendJsFile(WriteMode.COVER_EXISTS_FILE); //列表HTML页
        //列表HTML页
        //生成代码
        cfg.buildAll();
    }

    public static void main(String[] args) throws Exception {
        FinCompanySubjectGtr g=new FinCompanySubjectGtr();
        //生成代码
        g.generateCode();

        //移除之前生成的菜单，视情况执行
//        g.removeByBatchId("471622036347682816");
        //生成菜单
        //
    //  g.generateMenu(FinCompanySubjectServiceProxy.class, FinCompanySubjectPageController.class);
    }

}
